<!DOCTYPE html>
<html lang="en">
  <head>
    <title>
        Redis-4-主从复制、哨兵、集群 - rulerLwx Blog
      </title>
        <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    
    <meta name="theme-color" content="#000000" />
    
    <meta http-equiv="window-target" content="_top" />
    
    
    <meta name="description" content="复制（replication）-master/slave 可以实现当一台数据库中的数据更新后，自动将更新的数据同步同步到其它数据库上。 数据库分" />
    <meta name="generator" content="Hugo 0.73.0 with theme pure" />
    <title>Redis-4-主从复制、哨兵、集群 - rulerLwx Blog</title>
    
    
    <link rel="stylesheet" href="https://rulerLwx.gitee.io/css/style.min.c4bc7071f132c964c2116bca53b392933f377e5ca7b7051ed245187c621a2d3e.css">
    
    <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async>
    <meta property="og:title" content="Redis-4-主从复制、哨兵、集群" />
<meta property="og:description" content="复制（replication）-master/slave 可以实现当一台数据库中的数据更新后，自动将更新的数据同步同步到其它数据库上。 数据库分" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://rulerLwx.gitee.io/2020/07/redis-4-%E4%B8%BB%E4%BB%8E%E5%A4%8D%E5%88%B6%E5%93%A8%E5%85%B5%E9%9B%86%E7%BE%A4/" />
<meta property="article:published_time" content="2020-07-01T18:58:47+08:00" />
<meta property="article:modified_time" content="2020-07-01T18:58:47+08:00" />
<meta itemprop="name" content="Redis-4-主从复制、哨兵、集群">
<meta itemprop="description" content="复制（replication）-master/slave 可以实现当一台数据库中的数据更新后，自动将更新的数据同步同步到其它数据库上。 数据库分">
<meta itemprop="datePublished" content="2020-07-01T18:58:47&#43;08:00" />
<meta itemprop="dateModified" content="2020-07-01T18:58:47&#43;08:00" />
<meta itemprop="wordCount" content="2366">



<meta itemprop="keywords" content="" /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Redis-4-主从复制、哨兵、集群"/>
<meta name="twitter:description" content="复制（replication）-master/slave 可以实现当一台数据库中的数据更新后，自动将更新的数据同步同步到其它数据库上。 数据库分"/>

    <!--[if lte IE 9]>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
      <![endif]-->

    <!--[if lt IE 9]>
        <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
      <![endif]-->
  </head>

  
  

  <body class="main-center theme-black" itemscope itemtype="http://schema.org/WebPage"><header class="header" itemscope itemtype="http://schema.org/WPHeader">
    <div class="slimContent">
      <div class="navbar-header">
        <div class="profile-block text-center">
          <a id="avatar" href="https://gitee.com/rulerLwx" target="_blank">
            <img class="img-circle img-rotate" src="https://rulerLwx.gitee.io/avatar.png" width="200" height="200">
          </a>
          <h2 id="name" class="hidden-xs hidden-sm">rulerLwx</h2>
          <h3 id="title" class="hidden-xs hidden-sm hidden-md">thinking...</h3>
          <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i>Guangzhou, China</small>
        </div><div class="search" id="search-form-wrap">
    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="Search" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i
                        class="icon icon-search"></i></button>
            </span>
        </div>
        <div class="ins-search">
            <div class="ins-search-mask"></div>
            <div class="ins-search-container">
                <div class="ins-input-wrapper">
                    <input type="text" class="ins-search-input" placeholder="Type something..."
                        x-webkit-speech />
                    <button type="button" class="close ins-close ins-selectable" data-dismiss="modal"
                        aria-label="Close"><span aria-hidden="true">×</span></button>
                </div>
                <div class="ins-section-wrapper">
                    <div class="ins-section-container"></div>
                </div>
            </div>
        </div>
    </form>
</div>
        <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>
      <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
        <ul class="nav navbar-nav main-nav">
            <li class="menu-item menu-item-home">
                <a href="/">
                    <i class="icon icon-home-fill"></i>
                  <span class="menu-title">Home</span>
                </a>
            </li>
            <li class="menu-item menu-item-archives">
                <a href="/posts/">
                    <i class="icon icon-archives-fill"></i>
                  <span class="menu-title">Archives</span>
                </a>
            </li>
            <li class="menu-item menu-item-categories">
                <a href="/categories/">
                    <i class="icon icon-folder"></i>
                  <span class="menu-title">Categories</span>
                </a>
            </li>
            <li class="menu-item menu-item-tags">
                <a href="/tags/">
                    <i class="icon icon-tags"></i>
                  <span class="menu-title">Tags</span>
                </a>
            </li>
            <li class="menu-item menu-item-about">
                <a href="/about/">
                    <i class="icon icon-cup-fill"></i>
                  <span class="menu-title">About</span>
                </a>
            </li>
        </ul>
      </nav>
    </div>
  </header>

<aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">Board</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">enjoy~
            </div>
        </div>
    </div>
</div>

      <div class="widget">
    <h3 class="widget-title"> Categories</h3>
    <div class="widget-body">
        <ul class="category-list">
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-framework/" class="category-list-link">java-framework</a><span class="category-list-count">38</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-front-end/" class="category-list-link">java-front-end</a><span class="category-list-count">11</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-se/" class="category-list-link">java-se</a><span class="category-list-count">21</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-senior/" class="category-list-link">java-senior</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/linux/" class="category-list-link">linux</a><span class="category-list-count">13</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/tools/" class="category-list-link">tools</a><span class="category-list-count">1</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%8A%80%E6%9C%AF%E6%9D%82%E7%83%A9/" class="category-list-link">技术杂烩</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" class="category-list-link">数据库</a><span class="category-list-count">15</span></li>
        </ul>
    </div>
</div>
      <div class="widget">
    <h3 class="widget-title"> Tags</h3>
    <div class="widget-body">
        <ul class="tag-list">
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/jvm/" class="tag-list-link">jvm</a><span
                    class="tag-list-count">1</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/" class="tag-list-link">多线程</a><span
                    class="tag-list-count">2</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" class="tag-list-link">网络编程</a><span
                    class="tag-list-count">3</span></li>
            
        </ul>

    </div>
</div>
      
<div class="widget">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget-body">
        <ul class="recent-post-list list-unstyled no-thumbnail">
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E4%B8%80%E6%89%B9%E9%87%8F%E7%A7%BB%E5%8A%A8%E9%87%8D%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6/" class="title">自己动手（一）——批量移动、重命名文件</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-27 17:50:02 &#43;0800 CST" itemprop="datePublished">2020-07-27</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E5%85%B3%E4%BA%8Einteger%E7%9A%84-128~127%E7%BC%93%E5%AD%98/" class="title">关于Integer的 -128~127缓存</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-11 16:56:21 &#43;0800 CST" itemprop="datePublished">2020-07-11</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/" class="title">跨域问题</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-08 22:41:12 &#43;0800 CST" itemprop="datePublished">2020-07-08</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" class="title">个人博客搭建</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-05 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-05</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/centos/" class="title">CentOS-</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-01 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-01</time>
                    </p>
                </div>
            </li>
        </ul>
    </div>
</div>
  </div>
</aside>

    
    
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <h4 class="toc-title">Catalogue</h4>
    <nav id="toc" class="js-toc toc">

    </nav>
  </div>
</aside>
<main class="main" role="main"><div class="content">
  <article id="-" class="article article-type-" itemscope
    itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      <h1 itemprop="name">
  <a
    class="article-title"
    href="/2020/07/redis-4-%E4%B8%BB%E4%BB%8E%E5%A4%8D%E5%88%B6%E5%93%A8%E5%85%B5%E9%9B%86%E7%BE%A4/"
    >Redis-4-主从复制、哨兵、集群</a
  >
</h1>

      <div class="article-meta">
        
<span class="article-date">
  <i class="icon icon-calendar-check"></i>&nbsp;
<a href="https://rulerLwx.gitee.io/2020/07/redis-4-%E4%B8%BB%E4%BB%8E%E5%A4%8D%E5%88%B6%E5%93%A8%E5%85%B5%E9%9B%86%E7%BE%A4/" class="article-date">
  <time datetime="2020-07-01 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-01</time>
</a>
</span>
<span class="article-category">
  <i class="icon icon-folder"></i>&nbsp;
  <a class="article-category-link" href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/"> 数据库 </a>
</span>

        <span class="post-comment"><i class="icon icon-comment"></i>&nbsp;<a href="/2020/07/redis-4-%E4%B8%BB%E4%BB%8E%E5%A4%8D%E5%88%B6%E5%93%A8%E5%85%B5%E9%9B%86%E7%BE%A4/#comments"
            class="article-comment-link">Comments</a></span>
		<span class="post-wordcount hidden-xs" itemprop="wordCount">Word Count: 2366words</span>
		<span class="post-readcount hidden-xs" itemprop="timeRequired">Read Count: 5minutes </span>
      </div>
    </div>
    <div class="article-entry marked-body js-toc-content" itemprop="articleBody">
      <h1 id="复制replication-masterslave">复制（replication）-master/slave</h1>
<ul>
<li>可以实现当一台数据库中的数据更新后，自动将更新的数据同步同步到其它数据库上。</li>
<li>数据库分两类：主数据库（master）、从数据库（slave），主从是一对多关系，从主是一对一关系，主数据库可以读写（<strong>以写为主</strong>），从数据库<strong>只读</strong>且可以接受主数据库同步过来的数据。</li>
<li>如何配置？
<ul>
<li>方式一：只需要在从数据库的配置文件中加入“slaveof 主数据库地址 主数据库端口”即可，主数据库无需任何配置</li>
<li>方式二：<code>redis&gt; slaveof 127.0.0.1 6379</code>命。注意：此方式时临时性的，<code>SHUTDOWN</code>slave服务，重启服务后将失去slave身份</li>
</ul>
</li>
<li>如果该数据库已经是其它主数据库的从数据库了，<code>slaveof</code>命令会停止和原来数据库的同步转而和新数据库同步。</li>
<li><code>salveof no one</code>命令可以使用当前数据库停止接收其它数据库的同步并转为主数据库（master）。</li>
<li><code>info replication</code>命令可以查看当前数据库的主从状态</li>
<li>读写分离与一致性</li>
<li>无硬盘复制，配置文件（主？）：<code>repl-diskless-sync yes</code></li>
<li>增量复制，todo&hellip;</li>
</ul>
<p>示例：一主二从</p>
<p>1）首先拷贝三个redis.conf：redis6379.conf、redis6380.conf、redis6381.conf，每个文件修改相应配置项：</p>
<ul>
<li>开启<code>daemonize yes</code></li>
<li>pid文件名字：<code>pidfile /var/run/redis_6379.pid</code></li>
<li>指定端口：<code>port 6379</code></li>
<li>Log文件名字：<code>logfile &quot;6379.log&quot;</code></li>
<li>修改Dump.rdbf文件名字：<code>dbfilename dump-6379.rdb</code></li>
</ul>
<p>2）分别启动三个服务和客户端</p>
<p>在一台电脑上，<code>./redis-server redis6379.conf</code>指定不同的配置文件（修改好上面的配置项），可以启动多个Redis ——20190915</p>
<p>注意：此处使用的是命令行方式<code>redis&gt; slaveof 127.0.0.1 6379</code>，临时性的，关掉服务后失效。<strong>除非在 redis.conf 中配置</strong><code>slaveof 127.0.0.1 6379</code>，就可以永久生效。</p>
<p><img src="8A2D6D11AB1348A5A171ECE58E808DF9" alt="image"></p>
<p>3）复制的原理</p>
<p><img src="4B1A0B22146C468DA7BE4B1600BF7496" alt="image"></p>
<p>参考《尚硅谷-Redis视频》</p>
<p>注意：2.8之前使用<code>sync</code>命令，2.8之后使用<code>psync</code>命令 ——20200703</p>
<h1 id="哨兵sentinel">哨兵（sentinel）</h1>
<p>1）什么是哨兵？</p>
<p>当主数据库遇到异常中断服务后，开发者可以通过手动方式选择一个数据库升格为主数据库，以使系统能继续提供服务。此处需要人工介入，而哨兵工具可以实现自动化的系统监控和故障恢复功能。可以理解为“反客为主”。</p>
<p>2）哨兵的功能</p>
<ul>
<li>监控主从数据库是否正常</li>
<li>主数据库出现故障时自动将从数据库转换成主数据库，<strong>如果原来的主数据库恢复正常后，将变为从数据库</strong></li>
<li>哨兵之间也相互监控</li>
</ul>
<p>3）如何使用哨兵</p>
<ul>
<li>检查复制状态，以确保复制的正确性：<code>info replication</code></li>
<li>建立一个配置文件<code>sentinel.conf</code>,内容为 <code>sentinel monitor mymaster 127.0.0.1 6379 1</code></li>
<li>启动Sentinel进程<code>$ redis-sentinel /path/to/sentinel.conf</code></li>
<li>注意：配置哨兵监控一个系统时，只需要配置其监控主数据库即可，哨兵会自动发现所有复制该主数据库的从数据库</li>
</ul>
<p>4）实现原理</p>
<ul>
<li>启动哨兵进程的命令是：<code>sentinel monitor master-name ip redis-port quorum</code>
<ul>
<li>master-name 是主数据库的名字，只能是大小写字母、数字和“.-_”组成；</li>
<li>ip 是当前主数据库地址；</li>
<li>redis-port 是端口号；</li>
<li>quorum 表示执行故障恢复操作前至少需要几个哨兵节点同意。</li>
</ul>
</li>
<li>一个哨兵节点可同时监控多个主从系统，只需要提供一个sentinel monitor配置即可，如<code>sentinel monitor mymaster 127.0.0.1 6379 1</code>,和<code>sentinel monitor othermaster 192.168.1.3 6389 4</code></li>
<li>哨兵配置文件参数：<code>down-after-milliseconds</code>,&hellip;</li>
<li>实现原理有三点
<ul>
<li>每10秒哨兵向主数据库和从数据库发送ping命令</li>
<li>每2秒哨兵会向主数据库和从数据库的_sentinel_:hello频道发送自己的信息</li>
<li>每1秒哨兵会向主数据库、从数据库和其它哨兵节点发送ping命令</li>
</ul>
</li>
<li>哨兵部署方案：
<ul>
<li>为每个节点（无论是主数据库还是从数据库）部署一个哨兵</li>
<li>使每个哨兵与其对应节点的网络环境相同或相近</li>
<li>设置quorum值为N/2+1（N为哨兵节点数据）</li>
</ul>
</li>
</ul>
<p>5）总结</p>
<ol>
<li>哨兵机制是建立在复制（replication）的基础上，让复制更智能。——20190915</li>
<li>复制的缺点：复制延迟。因为，写操作是在 master 上操作，然后同步到 slave 上，所以从 master 同步到 slave 机器有一定延迟，当系统繁忙时更严重，slave机器数量的增多也会使这个问题更加严重。</li>
</ol>
<p>参考《Redis入门指南》第2版，李子骅</p>
<p>哨兵配置文件：</p>
<pre><code>sentinel monitor mymaster 127.0.0.1 6379 1
sentinel auth-pass mymaster 123456 # 密码，放在上面这句之后

</code></pre>
<h1 id="集群cluster">集群（cluster）</h1>
<p>将数据库复制多个副本以部署在不同的服务器上，即使有一台服务器出现故障，其它服务器可以继续提供服务。</p>
<p>哨兵建立在复制的基础上，哨兵和集群是两个独立的功能，但从特性来看，哨兵可视为集群的子集。</p>
<p>如果不需要数据分片或已经在客户端进行分片的情景下，哨兵就够用了。如果需要水平扩容，则集群是一个非常好的选择。</p>
<p>集群的目的：数据分片。</p>
<p>1）如何开启集群？</p>
<p>只需要将每个数据节点（redis服务端）的配置文件 redis.conf 中的<code>cluster-enabled yes</code>配置选项打开即可。
每个集群中至少需要3个主数据库才能正常运行。</p>
<p>参考《Redis入门指南》第2版，李子骅</p>
<p>todo&hellip;</p>
<hr>
<p>总结：</p>
<ul>
<li>单机版：数据量，QPS不大的情况使用</li>
<li>主从复制：需要读写分离，高可用的时候使用</li>
<li>Sentinel哨兵：需要自动容错容灾的时候使用</li>
<li>内置集群：数据量比较大，QPS有一定要求的时候使用，但集群节点不能过多</li>
<li>twemproxy集群：数据量，QPS要求非常高，可以使用</li>
</ul>
<p>以上描述了这几种模式的使用场景，但是其使用成本是从上往下递增的，所以到底是用那种模式，还是要结合具体的使用场景，预算成本来进行选择。</p>
<p>另外，这些模式也不是完全独立的，一般我们在使用twemproxy集群的时候都是高并发，大数据，高可用的环境，可以结合主从复制+哨兵保证集群的高可用，keepliaved保证代理服务器的高可用。其使用方式在本章节中都已经给大家介绍了，有兴趣的学员可以尝试自己整合一下。</p>
<p>《黑马十次方2.0》第6章</p>

    </div>
    <div class="article-footer">
<blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    <li class="post-copyright-link hidden-xs">
      <strong>Permalink: </strong>
      <a href="https://rulerLwx.gitee.io/2020/07/redis-4-%E4%B8%BB%E4%BB%8E%E5%A4%8D%E5%88%B6%E5%93%A8%E5%85%B5%E9%9B%86%E7%BE%A4/" title="Redis-4-主从复制、哨兵、集群" target="_blank" rel="external">https://rulerLwx.gitee.io/2020/07/redis-4-%E4%B8%BB%E4%BB%8E%E5%A4%8D%E5%88%B6%E5%93%A8%E5%85%B5%E9%9B%86%E7%BE%A4/</a>
    </li>
    <li class="post-copyright-license">
      <strong>License：</strong><a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN</a>
    </li>
  </ul>
</blockquote>

<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://gitee.com/rulerLwx" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="https://rulerLwx.gitee.io/avatar.png" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://gitee.com/rulerLwx" target="_blank"><span class="text-dark">rulerLwx</span><small class="ml-1x">thinking...</small></a></h3>
        <div>Good Good Study, Day Day Up~</div>
      </div>
    </figure>
  </div>
</div>
    </div>
  </article>
<section id="comments">
    <div id="vcomments"></div>
</section>

</div><nav class="bar bar-footer clearfix" data-stick-bottom>
    <div class="bar-inner">
        <ul class="pager pull-left">
            <li class="prev">
                <a href="https://rulerLwx.gitee.io/2020/07/redis-5-%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95/" title="Redis-5-性能测试"><i
                        class="icon icon-angle-left"
                        aria-hidden="true"></i><span>&nbsp;&nbsp;Older</span></a>
            </li>
            <li class="next">
                <a href="https://rulerLwx.gitee.io/2020/07/redis-3-%E4%BA%8B%E5%8A%A1%E6%8C%81%E4%B9%85%E5%8C%96/"
                    title="Redis-3-事务、持久化"><span>Newer&nbsp;&nbsp;</span><i
                        class="icon icon-angle-right" aria-hidden="true"></i></a>
            </li>
            
            <li class="toggle-toc">
                <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false"
                    title="Catalogue" role="button">
                    <span>[&nbsp;</span><span>Catalogue</span>
                    <i class="text-collapsed icon icon-anchor"></i>
                    <i class="text-in icon icon-close"></i>
                    <span>]</span>
                </a>
            </li>
        </ul>
        <div class="bar-right">
            <div class="share-component" data-sites="weibo,qq,wechat"
                data-mobile-sites="weibo,qq,qzone"></div>
        </div>
    </div>
</nav>

</main><footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
<ul class="social-links">
    <li><a href="https://gitee.com/rulerLwx" target="_blank" title="gitee" data-toggle=tooltip data-placement=top >
            <i class="icon icon-gitee"></i></a></li>
    <li><a href="https://github.com/wolf-lea" target="_blank" title="github" data-toggle=tooltip data-placement=top >
            <i class="icon icon-github"></i></a></li>
</ul>
  <div class="copyright">
    &copy;2020  -
    2020
    <div class="publishby">
        Theme by <a href="https://github.com/xiaoheiAh" target="_blank"> xiaoheiAh </a>base on<a href="https://github.com/xiaoheiAh/hugo-theme-pure" target="_blank"> pure</a>.
    </div>
  </div>
</footer>

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_SVG"></script>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
            showMathMenu: false, //disables context menu
            tex2jax: {
            inlineMath: [ ['$','$'], ['\\(','\\)'] ]
           }
    });
</script>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script>
    window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js"></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/python.min.js" defer></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/javascript.min.js" defer></script><script>
    hljs.configure({
        tabReplace: '    ', 
        classPrefix: ''     
        
    })
    hljs.initHighlightingOnLoad();
</script>
<script src="https://rulerLwx.gitee.io/js/application.min.bdeb64b910570b6c41badc6a05b7afb0c8ad9efd8525de3c7257d59e786326a3.js"></script>
<script src="https://rulerLwx.gitee.io/js/plugin.min.51ff8c7317566f82259170fa36e09c4493adc9b9378b427a01ad3f017ebac7dd.js"></script>

<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: 'Posts',
                PAGES: 'Pages',
                CATEGORIES: 'Categories',
                TAGS: 'Tags',
                UNTITLED: '(Untitled)',
            },
            ROOT_URL: 'https:\/\/rulerLwx.gitee.io',
            CONTENT_URL: 'https:\/\/rulerLwx.gitee.io\/searchindex.json ',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script type="text/javascript" src="https://rulerLwx.gitee.io/js/insight.min.a343cd9a5a7698336b28ef3a7c16a3a1b1d2d5fb17dc8ed04022bbe08cc5459073a15bdafa3a8a58cdd56080784bdd69fa70b1ae8597565c799c57ed00f0e120.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
<script>
    tocbot.init({
        
        tocSelector: '.js-toc',
        
        contentSelector: '.js-toc-content',
        
        headingSelector: 'h1, h2, h3',
        
        hasInnerContainers: true,
    });
</script>

<script src="https://cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine"></script>
<script type="text/javascript">
    var GUEST = ['nick', 'mail', 'link'];
    var meta = 'nick,mail';
    meta = meta.split(',').filter(function (item) {
        return GUEST.indexOf(item) > -1;
    });
    new Valine({
        el: '#vcomments',
        verify: null ,
        notify: null ,
        appId: 'IyAB0PSPRazTPDxitO1ddQ7O-gzGzoHsz',
        appKey: '5rBJTq4KidYF33eXwvRVhtEH',
        placeholder: 'enjoy~',
        avatar: 'mm',
        meta: meta,
        pageSize: '10' || 10,
        visitor: false 
});
</script>

  </body>
</html>
